<?php
defined("_ALLOW") or die ("Access denied");
?>
<?php
isset($_SESSION['username']) or die ("Bạn chưa đăng nhập");
include_once("class/cproduct.php");
global $objproduct;
$urlpaging = "";
$urlpaging  = "index.php?module=com_userlistproduct";
?>
<script language="javascript">
var url = "<?php echo $urlpaging; ?>";
function GotoPage (page) {
	var urltopage;
	urltopage = url + "&curPage=" + page;
	location.href = urltopage;
//	Ajax_Goto(url);
}
</script>
<div class="title_productcategory" style="padding-bottom:10px;">
Các sản phẩm đã đăng
</div>
<div class="td_listproduct_tt" style="font-family:Tahoma; font-size:11px; color:#333333; font-weight:bold;">
  <?php
	global $totalRows;
	$strwhere = "user='" . $_SESSION['username'] . "'";
  	$totalRows = $objproduct->CountFill($strwhere);
	if ($totalRows > 0) {
		global $maxRows;
		$maxRows = 50;
		global $maxPages;
		$maxPages = 10;
		include_once("common/paging.php");
		global $curPage;
		$paging = Paging_GetPaging();
		$beginrow = ($curPage-1) * $maxRows;
		$array = $objproduct->Fill($strwhere, $maxRows, $beginrow);
		?>
		<table width="95%" align="center" border="1" cellspacing="0" cellpadding="2" style="border-collapse:collapse">
		<tr>
		<th width="45%" style="font-family:Tahoma; font-size:12px; font-weight:bold; color:#333333;">Tiêu đề</th><th width="15%" style="font-family:Tahoma; font-size:12px; font-weight:bold; color:#333333;">Ngày đăng</th>
		</tr>
		<?php
		foreach ($array as $objproduct) {
		?>
		<tr>
		<td class="spdadang"><a href="index.php?module=com_useraddproduct&id=<?php echo $objproduct->id; ?>" ><?php echo $objproduct->title; ?></a></td>
		
		
		<td style="padding-left:5px; text-align:center"><?php echo substr($objproduct->flastupdate,5,11); ?></td>
		</tr>
		<?php
		}
		?>
		</table>
		<?php
		echo $paging;
	}
  ?>
</div>